﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Apex.Script.ViewModels;

namespace Script.Components.Controls
{
    /// <summary>
    /// Interaction logic for DynamicMapMarker.xaml
    /// </summary>
    public partial class DynamicMapMarker : UserControl
    {
        public LocationViewModel ViewModel { get; set; }

        public DynamicMapMarker(LocationViewModel vm)
        {
            ViewModel = vm;
            InitializeComponent();
            lblLabel.Text = vm.Name;
            Visual v = null;
            switch (ViewModel.Weather)
            {
                case Apex.Script.Models.WeatherType.Sunny:
                    v = (Visual)FindResource("appbar_weather_sun");
                    break;
                case Apex.Script.Models.WeatherType.Overcast:
                    v = (Visual)FindResource("appbar_weather_overcast");
                    break;
                case Apex.Script.Models.WeatherType.Raining:
                    v = (Visual)FindResource("appbar_weather_rain");
                    break;
                case Apex.Script.Models.WeatherType.Snowing:
                    v = (Visual)FindResource("appbar_weather_snow");
                    break;
                case Apex.Script.Models.WeatherType.Windy:
                    v = (Visual)FindResource("appbar_weather_chance");
                    break;
                case Apex.Script.Models.WeatherType.Heatwave:
                    v = (Visual)FindResource("appbar_weather_symbol");
                    break;
                case Apex.Script.Models.WeatherType.Freezing:
                    v = (Visual)FindResource("appbar_weather_symbol");
                    break;
                case Apex.Script.Models.WeatherType.Optimal:
                    v = (Visual)FindResource("appbar_weather_symbol");
                    break;
                default:
                    break;
            }

            weatherIcon.Visual = v;
        }
    }
}
